
 <template>
  <div class="top_company flex align-center justify-start ml-1"
       >
    <div class="colorfff font16 ">企业名称</div>
    <div class="flex align-center search_company ml-1">
      <el-input v-model="companyName"></el-input>
      <div @click="search"
           class="colorfff flex-1 flex justify-end mr-1 pointer">
        查看
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "back",
  data() {
    return {
      companyName: "",
    };
  },
  mounted() {},
  watch: {
    "$route.query.companyName": {
      immediate: true,
      deep: true,
      handler() {
        this.companyName = this.$route.query.companyName;
      },
    },
  },
  methods: {
    search() {
      let companyName = this.companyName
      
      if(this.$route.path == '/billingl'){
        this.$emit('companyName', companyName)
      }else{
        if(!companyName || companyName.length == 0) return 
        if (this.$route.path == "/companysale") {
        this.$router.replace({
          path: "/companysale",
          query: { companyName:  companyName},
        });
      } else {
        this.$router.push({
          path: "/companysale",
          query: { companyName: companyName },
        });
      }
      }
      
    },
  },
};
</script>
<style lang="stylus" scoped>
.main-title {
  top: 40px;
  left: 25px;
}

.back {
  width: 122px;
  height: 55px;

  img {
    width: 122px;
    height: 55px;
  }
}

.top_company {
  background-size: 100% 74px;
  overflow: hidden;
}

.btnbg {
  width: 76px;
  height: 54px;
  background: url('../assets/img/company/Bg.png') no-repeat;
  background-size: 76px 54px;
  cursor: pointer;
}

.search_company {
  height: 40px;
  width: 260px;
  color: #fff;
  border: 1px solid #1C4DA4;
  background-color: #0e215b;
}

/deep/ .el-input  {
  height: 30px;
  width: 200px;
  border: none;
  color: white;
  background: none !important;
}

/deep/ .el-input__inner {
  height: 30px;
  width: 200px;
  border: none;
  color: white;
  background: none !important;
}
</style>

